<include file="Public:_head" />
<include file="Public:left" />
	<link href="com_statics/style/custommenu.css" type="text/css" rel="stylesheet" />
	<div id="neirong">
		<!--<h2 class="lm_title">自定义菜单 </h2>-->
			<div id="DIYmenu">
				<h3 class="subTitle"><img src="com_statics/images/icon_11.gif" alt="图片描述" />自定义菜单<span>通过自定义菜单，帮助求职者了解贵公司招聘信息！</span></h3>
				<div class="content">
                    <!-- 文章内容开始 --><h4>您可以在此直接编辑功能菜单：</h4>
                    <ul>
                        <li>1、一级菜单最多三个，每个文字最多4个字；</li>
                        <li>2、二级菜单最多6个，每个文字最多4个字；</li>
                        <li>3、点击<a href="#"><img src="com_statics/images/icon_edit.gif" alt="图片描述" /></a>添加对应二级菜单；</li>
                        <li>4、点击<a href="#"><img src="com_statics/images/icon_del.gif" alt="图片描述" /></a>修改对应菜单文字；</li>
                    </ul>
                <!-- 文章内容结束 -->
           		</div>
				<div class="inner_container_box side_l cell_layout">                
					<div class="inner_container_box_bd">                    
						<div class="inner_side">                        
							<div class="bd">                            
								<div class="menu_manage">                                
									<div class="sub_title_bar light">                                    
										<h4>菜单管理</h4>                                    
										<div class="opr_wrp">                                        
											<a href="javascript:void(0);" id="addBt" class="opr_meta icon16_common add_gray">添加</a>&nbsp;
										</div>                                
									</div>                                
									<div class="inner_menu_box gray with_switch ui-sortable ui-sortable-disabled" id="menuList">
										<dl class="inner_menu jsMenu ui-sortable ui-sortable-disabled">
										<volist name="menu" id="fm">
											<dt class="inner_menu_item jslevel1">
												<a href="javascript:void(0);" data-index="menu_{$fm.fmenu.mid}" class="inner_menu_link editmenu"><strong>{$fm.fmenu.menu}</strong></a>
												<span class="menu_opr" id="menu_{$fm.fmenu.mid}">
													<a href="javascript:void(0);" class="icon14_common add_gray jsAddBt">添加</a>
													<a href="javascript:void(0);" class="icon14_common  edit_gray jsEditBt">编辑</a>
													<a href="javascript:void(0);" class="icon14_common del_gray jsDelBt">删除</a>
												</span>
											</dt>
											<volist name="fm.smenu" id="sm">
											<dd class="inner_menu_item jslevel2 submenu_{$fm.fmenu.mid}">
												<i class="icon_dot">●</i>
												<a href="javascript:void(0);" class="inner_menu_link editsubmenu" data-index="subMenu_menu_{$sm.mid}">
													<strong>{$sm.menu}</strong>
												</a>
												<span class="menu_opr" id="subMenu_menu_{$sm.mid}">
													<a href="javascript:void(0);" class="icon14_common edit_gray jsSubEditBt">编辑</a>
													<a href="javascript:void(0);" class="icon14_common del_gray jsSubDelBt">删除</a>
												</span>
											</dd>
											</volist>
										</volist>
										</dl>
									</div>                            
								</div>                        
							</div>                    
						</div>                    
						<div class="inner_main">                        
							<div class="bd">                            
								<div class="action_setting">                                
									<div class="sub_title_bar light">                                    
										<h4>设置动作</h4>
									</div>
									<div class="action_content default jsMain" id="none" style="display: none;">
										<p class="action_tips">你可以先添加一个菜单，然后开始为其设置响应动作</p>
									</div>
									<div class="action_content url jsMain" id="action_content_html" style="display: block;">
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="push_button" style="margin:10px 0;text-align:center"> 
					<a href="{:U('Weixin/push_custommenu')}"><button class="btn_send"  type="submit">发布到微信</button></a>
				</div>
			</div>
			<!-- DIYmenu结束 -->
	</div>
		<!-- neirong结束 -->
		<span class="clear"></span>
		<!-- 清除浮动 -->
	<!-- container结束 -->
<script>
	$(document).ready(function(){
		$(".menu_tree dd").mouseover(function(){
			$(this).addClass('menu_hover');
		});
		$(".menu_tree dt").mouseover(function(){
			$(this).addClass('menu_hover');
		});
		$(".menu_tree dd").mouseleave(function(){
			$(this).removeClass('menu_hover');
		});
		$(".menu_tree dt").mouseleave(function(){
			$(this).removeClass('menu_hover');
		});
		$(".pop_closed").live('click',function(){
			hidedialog();
		});
		$(".js_btn").live('click',function(){
			option = $(this).attr('data-index');
			if(option==1){
				hidedialog();
			}else{
				$("#popupForm_").submit();
			}
		});
		$("#addBt").click(function(){
			$.post('__URL__/add_menu',{},function(res){
				showdialog(res);
			});
		});
		$(".jsAddBt").click(function(){
			menu_id = $(this).parent().attr('id');
			fid = menu_id.split('_');
			$.post('__URL__/add_menu',{fid:fid[1]},function(res){
				showdialog(res);
			});
		});
		$(".jsEditBt").click(function(){
			menu_id = $(this).parent().attr('id');
			mid = menu_id.split('_');
			$.post('__URL__/edit_menu',{mid:mid[1]},function(res){
				showdialog(res);
			});
		});
		$(".jsSubEditBt").click(function(){
			menu_id = $(this).parent().attr('id');
			mid = menu_id.split('_');
			$.post('__URL__/edit_menu',{mid:mid[2]},function(res){
				showdialog(res);
			});
		});
		$(".jsDelBt").click(function(){
			menu_id = $(this).parent().attr('id');
			mid = menu_id.split('_');
			element = $(this);
			$.post('__URL__/del_menu',{mid:mid[1]},function(res){
				element.parent().parent().remove();
				$(".submenu_"+mid[1]).each(function(){
					$(this).remove();
				});
			});
		});
		$(".jsSubDelBt").click(function(){
			menu_id = $(this).parent().attr('id');
			mid = menu_id.split('_');
			element = $(this);
			$.post('__URL__/del_menu',{mid:mid[2]},function(res){
				element.parent().parent().remove();
			});
		});
		$(".editmenu").click(function(){
			menu_id = $(this).attr('data-index');
			mid = menu_id.split('_');
			$.post('__URL__/edit_menu_data',{mid:mid[1]},function(res){
				$('#action_content_html').html(res);
			});
		});
		$(".editsubmenu").click(function(){
			menu_id = $(this).attr('data-index');
			mid = menu_id.split('_');
			$.post('__URL__/edit_menu_data',{mid:mid[2]},function(res){
				$('#action_content_html').html(res);
			});
		});
		function showdialog(html){
			dialog = '<div class="dialog_wrp simple label_block" style="width: 726px; margin-left: -363px; margin-top: -190.5px;"><div class="dialog"><div class="dialog_hd"><h3>输入提示框</h3><a href="javascript:;" onclick="return false" class="icon16_opr closed pop_closed">关闭</a></div><div class="dialog_bd"><div class="simple_dialog_content">'+html+'</div></div><div class="dialog_ft"><span class="btn_input js_btn_p"><button type="button" class="js_btn" data-index="0">确认</button></span><span class="btn_input js_btn_p"><button type="button" class="js_btn" data-index="1">取消</button></span></div></div></div><div class="mask"><iframe frameborder="0" style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity:0);position:absolute;top:0px;left:0px;width:100%;height:100%;" src="about:blank"></iframe></div>';
			$("#container").append(dialog);
		}
		function hidedialog(){
			$(".dialog_wrp").remove();
			$(".mask").remove();
		}
	});
</script>
<include file="Public:bottom" />
